package com.freemyleft.left.left_app.mian.index.work.roborder.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.freemyleft.left.left_app.R;
import com.freemyleft.left.zapp.ui.recycler.MultipleItemEntity;
import com.freemyleft.left.zapp.ui.recycler.MultipleRecyclerAdapter;
import com.freemyleft.left.zapp.ui.recycler.MultipleViewHolder;

import java.util.List;

import cn.iwgang.countdownview.CountdownView;

public class RobOrderAdapter extends MultipleRecyclerAdapter{
    public static final int  ROB_ORDER_TYPE=006;
    public RobOrderAdapter(List<MultipleItemEntity> data) {
        super(data);
        addItemType(ROB_ORDER_TYPE, R.layout.item_roborder);
    }

    @Override
    protected void convert(MultipleViewHolder holder, MultipleItemEntity entity) {
        super.convert(holder, entity);
        String id=entity.getField(RobOrderFiles.ID);
        String date=entity.getField(RobOrderFiles.DATE);
        String status=entity.getField(RobOrderFiles.STATUS);
        String location=entity.getField(RobOrderFiles.LOCATION);
        String studendMessage=entity.getField(RobOrderFiles.STUDENT_MESSAGE);
        String price=entity.getField(RobOrderFiles.PRICE);
        String head=entity.getField(RobOrderFiles.HEAD);
        long  endTime=Long.valueOf((String) entity.getField(RobOrderFiles.END_TIME));
        holder.setText(R.id.tv_student_message,studendMessage);
        holder.setText(R.id.tv_location,location);
        holder.setText(R.id.tv_price,"￥"+price+"/小时");
        holder.setText(R.id.id,id);
//        holder.setText(R.id.date,date);
        holder.setText(R.id.tv_status,status);
        Glide.with(mContext).load(head).into((ImageView) holder.getView(R.id.student_photo));
        CountdownView countdownView=holder.getView(R.id.time_kill_DownTime_countdownView);
        countdownView.start(endTime);
        holder.addOnClickListener(R.id.btn_rob_order);
    }

    public enum RobOrderFiles{
        END_TIME,
        DATE,
        ROB_DATE,
        STATUS,
        STUDENT_MESSAGE,
        PRICE,
        LOCATION,
        WO_YAO_QIANG_DAN,
        HEAD,
        ID,



    }
}
